<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>


<%@page contentType="text/html" pageEncoding="UTF-8"%>

<fieldset class="form-container " style="width:80%;margin-left:5%;"> 
    <form:form id="form_782213"    method="post" action="/modele/bulletinpaie/update.do" modelAttribute="modelpaie" autocomplete="on">
        <legend class="form-title"><h2>Modification d'un mod&egrave;le de bulletin de paie</h2></legend>
        <h3 style="margin-bottom: 5%;margin-left: 1%">Veuillez renseigner les champs ci-dessous :</h3>
        <form:errors path="*" cssClass="errorblock" element="div"></form:errors>
            <div class="form-title">Nom du bulletin </div>
        <form:input class="form-field" type="text" path="nom" tabindex="1"/>

        <form:hidden path="id"/>

        <table name = "ligneBulletinPaieModele" id="ligneBulletinPaieModele">
        </table>



        <div class="submit-container" style=" clear: left;">
            <form:button class="submit-button" type="submit" >Enregistrer</form:button>
                <a href="/modele/bulletinpaie/index.do" class="submit-button">Annuler</a>

            </div>
    </form:form>


</fieldset>

<script id="jsSource" type="text/javascript">
    var nbGroup = 0;
            $(function() {
            // Initialize appendGrid

            $('#ligneBulletinPaieModele').appendGridBulletinPaie({
            caption: '',
                    hideButtons: {
                    moveUp:true,
                            moveDown:true,
                            insert:true
                    },
                    hideRowNumColumn:true,
                    initRows: 1,
                    columns: [
                    {name: 'id', display: 'Id', type: 'hidden', ctrlCss: {width: '160px'}},
                    {name: 'positionBulletin', ctrlClass: 'numeric', display: 'Ligne', type: 'number', ctrlCss: {width: '50px'}},
                    {name: 'nom', display: 'Nom de la ligne', type: 'text', ctrlCss: {width: '160px'}},
                    {name: 'boldCaracter', display: 'Gras', type: 'checkbox', ctrlCss: {width: '50px'}, ctrlProp: { checked: false }},
                    {name: 'tauxSalarial', ctrlClass: 'numeric', display: 'Taux Salarial', type: 'text', ctrlCss: {width: '50px'}},
                    {name: 'baselignePaieSalariale', display: 'Base', type: 'select', ctrlCss: {width: '75px'}, ctrlOptions: {'Aucune': 'Aucune', AssieteCotisationBrut : 'Assiette Cotisation Brut', NombreHeureSansConge :'Nombres heures sans congés'}},
                    {name: 'typeBaseLigneSalarial', display: 'Type Base', type: 'select', ctrlCss: {width: '75px'}, ctrlOptions: {'Aucun': 'Aucun', 'Pourcentage': 'Pourcentage', Nombre : 'Nombre'}},
                    {name: 'chargeSalarialImposable', display: 'Imposable', type: 'checkbox', ctrlCss: {width: '50px'}},
                    {name: 'tauxPatronal', ctrlClass: 'numeric', display: 'Taux Patronal', type: 'text', ctrlCss: {width: '50px'}},
                    {name: 'baselignePaiePatronal', display: 'Base', type: 'select', ctrlCss: {width: '75px'}, ctrlOptions: {'Aucune': 'Aucune', AssieteCotisationBrut :'Assiette Cotisation Brut', NombreHeureSansConge :'Nombres heures sans congés'}},
                    {name: 'typeBaseLignePatronal', display: 'Type Base', type: 'select', ctrlCss: {width: '75px'}, ctrlOptions: {'Aucun': 'Aucun', 'Pourcentage': 'Pourcentage', Nombre : 'Nombre'}}
                    ], idPrefix: 'ligneBulletinPaieModele[0]'
            });
                    $('.numeric').numeric(".");
            });</script>

<script id="jsSourceError" type="text/javascript">
            function reinitError() {



            var data = [
    <c:forEach var="ligne" items="${modelpaie.ligneBulletinPaieModele}" varStatus="statusL">
        <c:choose>
            <c:when test="${statusL.index==modelpaie.ligneBulletinPaieModele.size()-1}">
            {id:'${ligne.id}',
                    nom: '${ligne.nom}',
                    positionBulletin:'${ligne.positionBulletin}',
                    boldCaracter:'<c:if test="${ligne.boldCaracter==true}">true</c:if>',
                                        tauxSalarial: '${ligne.tauxSalarial}',
                                        baselignePaieSalariale:'${ligne.baselignePaieSalariale}',
                                        typeBaseLigneSalarial:'${ligne.typeBaseLigneSalarial}',
                                        chargeSalarialImposable:'<c:if test="${ligne.chargeSalarialImposable==true}">true</c:if>',
                                                            tauxPatronal: '${ligne.tauxPatronal}',
                                                            baselignePaiePatronal: '${ligne.baselignePaiePatronal}',
                                                            typeBaseLignePatronal:'${ligne.typeBaseLignePatronal}'
                                                    }
            </c:when>
            <c:otherwise>
                                                    {id:'${ligne.id}',
                                                            nom: '${ligne.nom}',
                                                            positionBulletin:'${ligne.positionBulletin}',
                                                            boldCaracter:'<c:if test="${ligne.boldCaracter==true}">true</c:if>',
                                                                                tauxSalarial: '${ligne.tauxSalarial}',
                                                                                baselignePaieSalariale:'${ligne.baselignePaieSalariale}',
                                                                                typeBaseLigneSalarial:'${ligne.typeBaseLigneSalarial}',
                                                                                chargeSalarialImposable:'<c:if test="${ligne.chargeSalarialImposable==true}">true</c:if>',
                                                                                                    tauxPatronal: '${ligne.tauxPatronal}',
                                                                                                    baselignePaiePatronal: '${ligne.baselignePaiePatronal}',
                                                                                                    typeBaseLignePatronal:'${ligne.typeBaseLignePatronal}'
                                                                                            },
            </c:otherwise>


        </c:choose>


    </c:forEach>

                                                                                            ];
                                                                                                    $('#ligneBulletinPaieModele').appendGridBulletinPaie('load', data);
                                                                                            }
                                                                                    $(function() {
                                                                                    reinitError();
                                                                                            $('.numeric').numeric(".");
                                                                                    });
</script>
